package com.googlecode.wstester.handlers

import com.googlecode.wstester.config.TestConfig
import com.googlecode.wstester.config.utils.{OneShot, Conversation, Simple}

/**
 * Created by IntelliJ IDEA.
 * User: pablo
 * Date: 2010-07-05
 * Time: 12:20:36
 */

class TestHandler(var testConfig: TestConfig, var testDirname: String) {
  def runTest = {
    testConfig testType match {
      case t: Simple => {
        val testHandler = new SimpleTestHandler(testConfig.requests.first, testDirname);
        testHandler.performRequest;
      }
      case t: Conversation => {

      }
      case t: OneShot => {
        val testHandler = new OneShotTestHandler(testConfig.requests.first, testDirname);
        testHandler.performRequest;
      }              
      case _ => {
        throw new IllegalArgumentException("Unknown test type");
      }
    }
  }
}